<widget-modal widget-modal-title="Configure Deploy Widget">
    <form class="deploy-config" name="configForm"
          ng-submit="deployConfig.submit(configForm.$valid,deployConfig.deployJob)" novalidate="novalidate">
        <form-group input="deployJob" errors="{required:'Please select your application'}">

	    <input
			type="text" name="collectorItemId" class="form-control"
			placeholder="Search for a deployment application"
			ng-model="deployConfig.deployJob"
			uib-typeahead="job as job.name for job in getDeploymentJobs($viewValue)"
			typeahead-focus 
			typeahead-template-url="deploymentsUrlTemplate.html"
			typeahead-min-length="0" 
			typeahead-wait-ms="250" 
			autocomplete="off"
			typeahead-no-results="noResults" 
			required>
	
		<div class="form-control" ng-show="noResults">
			No Results Found
		</div>
        
        <form-group input="ignoreRegex" errors="{validregex:'Please enter a valid Regular Expression'}">
	
	        <label class="modal-label">Ignore Environment Failures Pattern:</label>
	        <input type="text"
	               name="ignoreRegex"
	               class="form-control text-center"
	               ng-model="deployConfig.ignoreRegex"
	               placeholder="Enter Regex"
	               autocomplete="on"
	               validregex />
	    </form-group>

        <div class="form-group checkbox">
            <label title="If true deployments with the same name and ID that processed in different servers will grouped together">
                <input type="checkbox" name="aggregateServers" ng-model="deployConfig.aggregateServers" ng-change="reload()">
                Aggregate Servers
            </label>
        </div>

        <hr/>

        <div class="form-group text-center">
            <label class="modal-label">
                Alert takeover criteria:
            </label>
            <br/>
            If any environment is down
        </div>

        <div class="button-row row text-center">
            <button type="submit" class="btn btn-primary btn-wide">Save</button>
        </div>
    </form>
</widget-modal>
<script type="text/ng-template" id="deploymentsUrlTemplate.html">
	<a title={{match.model.group}}>
		<span ng-bind-html="match.model.name | uibTypeaheadHighlight:query"/> 
	</a>
</script>